package com.edu.glutdataconvertclient.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.edu.glutdataconvertclient.mapper.auto.*;
import com.edu.glutdataconvertclient.service.AsyncService;
import com.edu.glutdataconvertclient.service.MqService;
import com.edu.glutdataconvertcommon.domain.*;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author ares
 */
@Service
@Slf4j
public class AsyncServiceImpl implements AsyncService {

    private TGlutDcJhkczlbMapper tGlutDcJhkczlbMapper;
    private TGlutDcJsjbsjzlbMapper tGlutDcJsjbsjzlbMapper;
    private TGlutDcJxhbxxMapper tGlutDcJxhbxxMapper;
    private TGlutDcKcsjlbMapper tGlutDcKcsjlbMapper;
    private TGlutDcKcsjlbXxxsMapper tGlutDcKcsjlbXxxsMapper;
    private TGlutDcKsapsjlbMapper tGlutDcKsapsjlbMapper;
    private TGlutDcSkjsxxMapper tGlutDcSkjsxxMapper;
    private TGlutDcXksjlbMapper tGlutDcXksjlbMapper;
    private TGlutDcZtjhzlbMapper tGlutDcZtjhzlbMapper;
    private TGlutDcZyxxsjlbMapper tGlutDcZyxxsjlbMapper;
    private TGlutDcXjjbsjzlbMapper tGlutDcXjjbsjzlbMapper;
    private TGlutDcXsjbsjzlMapper tGlutDcXsjbsjzlMapper;
    private TGlutDcBjsjlbMapper tGlutDcBjsjlbMapper;
    private TGlutDcJiankaoMapper tGlutDcJiankaoMapper;
    private TGlutDcKsbjMapper tGlutDcKsbjMapper;
    private TGlutDcKsMapper tGlutDcKsMapper;
    private TGlutDcZyjsBjMapper tGlutDcZyjsBjMapper;
    private TGlutDcZyjsKaoshengMapper tGlutDcZyjsKaoshengMapper;
    private TGlutDcZyjsMapper tGlutDcZyjsMapper;
    private TGlutDcBmxxMapper tGlutDcBmxxMapper;
    private TGlutDcJssysjzlbMapper tGlutDcJssysjzlbMapper;
    private TGlutDcJwKsqlcJgxxMapper tGlutDcJwKsqlcJgxxMapper;
    private ViewGlutJwKsqlcJgxxMapper viewGlutJwKsqlcJgxxMapper;
    private TGlutDcKcbJsMapper tGlutDcKcbJsMapper;
    private MqService mqService;

    public AsyncServiceImpl(TGlutDcJhkczlbMapper tGlutDcJhkczlbMapper,
                            TGlutDcJsjbsjzlbMapper tGlutDcJsjbsjzlbMapper,
                            TGlutDcJxhbxxMapper tGlutDcJxhbxxMapper,
                            TGlutDcKcsjlbMapper tGlutDcKcsjlbMapper,
                            TGlutDcKcsjlbXxxsMapper tGlutDcKcsjlbXxxsMapper,
                            TGlutDcKsapsjlbMapper tGlutDcKsapsjlbMapper,
                            TGlutDcSkjsxxMapper tGlutDcSkjsxxMapper,
                            TGlutDcXksjlbMapper tGlutDcXksjlbMapper,
                            TGlutDcZtjhzlbMapper tGlutDcZtjhzlbMapper,
                            TGlutDcZyxxsjlbMapper tGlutDcZyxxsjlbMapper,
                            TGlutDcXjjbsjzlbMapper tGlutDcXjjbsjzlbMapper,
                            TGlutDcXsjbsjzlMapper tGlutDcXsjbsjzlMapper,
                            TGlutDcBjsjlbMapper tGlutDcBjsjlbMapper,
                            TGlutDcJiankaoMapper tGlutDcJiankaoMapper,
                            TGlutDcKsbjMapper tGlutDcKsbjMapper,
                            TGlutDcKsMapper tGlutDcKsMapper,
                            TGlutDcZyjsBjMapper tGlutDcZyjsBjMapper,
                            TGlutDcZyjsKaoshengMapper tGlutDcZyjsKaoshengMapper,
                            TGlutDcZyjsMapper tGlutDcZyjsMapper,
                            TGlutDcBmxxMapper tGlutDcBmxxMapper,
                            TGlutDcJssysjzlbMapper tGlutDcJssysjzlbMapper,
                            TGlutDcJwKsqlcJgxxMapper tGlutDcJwKsqlcJgxxMapper,
                            ViewGlutJwKsqlcJgxxMapper viewGlutJwKsqlcJgxxMapper,
                            TGlutDcKcbJsMapper tGlutDcKcbJsMapper,
                            MqService mqService) {
        this.tGlutDcJhkczlbMapper = tGlutDcJhkczlbMapper;
        this.tGlutDcJsjbsjzlbMapper = tGlutDcJsjbsjzlbMapper;
        this.tGlutDcJxhbxxMapper = tGlutDcJxhbxxMapper;
        this.tGlutDcKcsjlbMapper = tGlutDcKcsjlbMapper;
        this.tGlutDcKcsjlbXxxsMapper = tGlutDcKcsjlbXxxsMapper;
        this.tGlutDcKsapsjlbMapper = tGlutDcKsapsjlbMapper;
        this.tGlutDcSkjsxxMapper = tGlutDcSkjsxxMapper;
        this.tGlutDcXksjlbMapper = tGlutDcXksjlbMapper;
        this.tGlutDcZtjhzlbMapper = tGlutDcZtjhzlbMapper;
        this.tGlutDcZyxxsjlbMapper = tGlutDcZyxxsjlbMapper;
        this.tGlutDcXjjbsjzlbMapper = tGlutDcXjjbsjzlbMapper;
        this.tGlutDcXsjbsjzlMapper = tGlutDcXsjbsjzlMapper;
        this.tGlutDcBjsjlbMapper = tGlutDcBjsjlbMapper;
        this.tGlutDcJiankaoMapper = tGlutDcJiankaoMapper;
        this.tGlutDcKsbjMapper = tGlutDcKsbjMapper;
        this.tGlutDcKsMapper = tGlutDcKsMapper;
        this.tGlutDcZyjsBjMapper = tGlutDcZyjsBjMapper;
        this.tGlutDcZyjsKaoshengMapper = tGlutDcZyjsKaoshengMapper;
        this.tGlutDcZyjsMapper = tGlutDcZyjsMapper;
        this.tGlutDcBmxxMapper = tGlutDcBmxxMapper;
        this.tGlutDcJssysjzlbMapper = tGlutDcJssysjzlbMapper;
        this.tGlutDcJwKsqlcJgxxMapper = tGlutDcJwKsqlcJgxxMapper;
        this.viewGlutJwKsqlcJgxxMapper = viewGlutJwKsqlcJgxxMapper;
        this.tGlutDcKcbJsMapper = tGlutDcKcbJsMapper;
        this.mqService = mqService;
    }

    @Async("glutExecutor")
    @Override
    public void getViewGxjxJhkczlb(Integer pageNo, Integer pageSize) {
        PageHelper.startPage(pageNo, pageSize, "jxjhh");
        List<TGlutDcJhkczlb> tGlutDcJhkczlbs = tGlutDcJhkczlbMapper.selectAll();
        mqService.directGxjxJhkczlbs(tGlutDcJhkczlbs);
    }

    @Async("glutExecutor")
    @Override
    public void getViewGxjxJsjbsjzlb(Integer pageNo, Integer pageSize) {
        PageHelper.startPage(pageNo, pageSize, "xqh");
        List<TGlutDcJsjbsjzlb> tGlutDcJsjbsjzlbs = tGlutDcJsjbsjzlbMapper.selectAll();
        mqService.directGxjxJsjbsjzlb(tGlutDcJsjbsjzlbs);
    }

    @Async("glutExecutor")
    @Override
    public void getViewGxjxJxhbxx(Integer pageNo, Integer pageSize) {
        PageHelper.startPage(pageNo, pageSize, "jxbh");
        List<TGlutDcJxhbxx> gxjxJxhbxxes = tGlutDcJxhbxxMapper.selectAll();
        mqService.directGxjxJxhbxx(gxjxJxhbxxes);
    }

    @Async("glutExecutor")
    @Override
    public void getViewGxjxKcsjlb(Integer pageNo, Integer pageSize) {
        PageHelper.startPage(pageNo, pageSize, "kch");
        List<TGlutDcKcsjlb> tGlutDcKcsjlbs = tGlutDcKcsjlbMapper.selectAll();
        mqService.directGxjxKcsjlb(tGlutDcKcsjlbs);
    }

    @Async("glutExecutor")
    @Override
    public void getViewGxjxKcsjlbXxxs(Integer pageNo, Integer pageSize) {
        PageHelper.startPage(pageNo, pageSize, "kch");
        List<TGlutDcKcsjlbXxxs> tGlutDcKcsjlbXxxs = tGlutDcKcsjlbXxxsMapper.selectAll();
        mqService.directGxjxKcsjlbXxxs(tGlutDcKcsjlbXxxs);
    }

    @Async("glutExecutor")
    @Override
    public void getViewGxjxKsapsjlb(Integer pageNo, Integer pageSize) {
//        Integer count = tGlutDcKsapsjlbMapper.selectCount(new TGlutDcKsapsjlb());
//        if (count > limit) {
//            Double ceil = Math.ceil(count / limit);
//            for (int i = 0, length = ceil.intValue(); length > i; i++) {
        PageHelper.startPage(pageNo, pageSize, "jkrgh");
        List<TGlutDcKsapsjlb> tGlutDcKsapsjlbs = tGlutDcKsapsjlbMapper.selectAll();
        mqService.directGxjxKsapsjlb(tGlutDcKsapsjlbs);
//            }
//        }
    }

    @Async("glutExecutor")
    @Override
    public void getViewGxjxSkjsxx(Integer pageNo, Integer pageSize) {
//        Integer count = tGlutDcSkjsxxMapper.selectCount(new TGlutDcSkjsxx());
//        if (count > limit) {
//            Double ceil = Math.ceil(count / limit);
//            for (int i = 0, length = ceil.intValue(); length > i; i++) {
        PageHelper.startPage(pageNo, pageSize, "jxbh");
        List<TGlutDcSkjsxx> tGlutDcSkjsxxes = tGlutDcSkjsxxMapper.selectAll();
        mqService.directGxjxSkjsxx(tGlutDcSkjsxxes);
//            }
//        }
    }

    @Async("glutExecutor")
    @Override
    public void getViewGxjxXksjlb(Integer pageNo, Integer pageSize) {
        PageHelper.startPage(pageNo, pageSize, "kch");
        List<TGlutDcXksjlb> tGlutDcXksjlbs = tGlutDcXksjlbMapper.selectAll();
        mqService.directGxjxXksjlb(tGlutDcXksjlbs);
    }

    @Async("glutExecutor")
    @Override
    public void getViewGxjxZtjhzlb(Integer pageNo, Integer pageSize) {
//        Integer count = tGlutDcZtjhzlbMapper.selectCount(new TGlutDcZtjhzlb());
//        if (count > limit) {
//            Double ceil = Math.ceil(count / limit);
//            for (int i = 0, length = ceil.intValue(); length > i; i++) {
        PageHelper.startPage(pageNo, pageSize, "jxjhh");
        List<TGlutDcZtjhzlb> tGlutDcZtjhzlbs = tGlutDcZtjhzlbMapper.selectAll();
        mqService.directGxjxZtjhzlb(tGlutDcZtjhzlbs);
//            }
//        }
    }

    @Async("glutExecutor")
    @Override
    public void getViewGxjxZyxxsjlb(Integer pageNo, Integer pageSize) {
//        Integer count = tGlutDcZyxxsjlbMapper.selectCount(new TGlutDcZyxxsjlb());
//        if (count > limit) {
//            Double ceil = Math.ceil(count / limit);
//            for (int i = 0, length = ceil.intValue(); length > i; i++) {
        PageHelper.startPage(pageNo, pageSize, "zyh");
        List<TGlutDcZyxxsjlb> tGlutDcZyxxsjlbs = tGlutDcZyxxsjlbMapper.selectAll();
        mqService.directGxjxZyxxsjlb(tGlutDcZyxxsjlbs);
//            }
//        }
    }

    @Async("glutExecutor")
    @Override
    public void getViewGxxsXjjbsjzlb(Integer pageNo, Integer pageSize) {
//        Integer count = tGlutDcXjjbsjzlbMapper.selectCount(new TGlutDcXjjbsjzlb());
//        if (count > limit) {
//            Double ceil = Math.ceil(count / limit);
//            for (int i = 0, length = ceil.intValue(); length > i; i++) {
        PageHelper.startPage(pageNo, pageSize, "xh");
        List<TGlutDcXjjbsjzlb> tGlutDcXjjbsjzlbs = tGlutDcXjjbsjzlbMapper.selectAll();
        mqService.directGxxsXjjbsjzlb(tGlutDcXjjbsjzlbs);
//            }
//        }
    }

    @Async("glutExecutor")
    @Override
    public void getViewGxxsXsjbsjzl(Integer pageNo, Integer pageSize) {
//        Integer count = tGlutDcXsjbsjzlMapper.selectCount(new TGlutDcXsjbsjzl());
//        if (count > limit) {
//            Double ceil = Math.ceil(count / limit);
//            for (int i = 0, length = ceil.intValue(); length > i; i++) {
        PageHelper.startPage(pageNo, pageSize, "xh");
        List<TGlutDcXsjbsjzl> tGlutDcXsjbsjzls = tGlutDcXsjbsjzlMapper.selectAll();
        mqService.directGxxsXsjbsjzl(tGlutDcXsjbsjzls);
//            }
//        }
    }

    @Async("glutExecutor")
    @Override
    public void getViewGxxxBjsjlb(Integer pageNo, Integer pageSize) {
//        Integer count = tGlutDcBjsjlbMapper.selectCount(new TGlutDcBjsjlb());
//        if (count > limit) {
//            Double ceil = Math.ceil(count / limit);
//            for (int i = 0, length = ceil.intValue(); length > i; i++) {
        PageHelper.startPage(pageNo, pageSize, "bh");
        List<TGlutDcBjsjlb> tGlutDcBjsjlbs = tGlutDcBjsjlbMapper.selectAll();
        mqService.directGxxxBjsjlb(tGlutDcBjsjlbs);
//            }
//        }
    }

    @Async("glutExecutor")
    @Override
    public void getViewKsJiankao(Integer pageNo, Integer pageSize) {
//        Integer count = tGlutDcJiankaoMapper.selectCount(new TGlutDcJiankao());
//        if (count > limit) {
//            Double ceil = Math.ceil(count / limit);
//            for (int i = 0, length = ceil.intValue(); length > i; i++) {
        PageHelper.startPage(pageNo, pageSize, "id");
        List<TGlutDcJiankao> tGlutDcJiankaos = tGlutDcJiankaoMapper.selectAll();
        mqService.directViewKsJiankao(tGlutDcJiankaos);
//            }
//        }
    }

    @Async("glutExecutor")
    @Override
    public void getViewKsKsbj(Integer pageNo, Integer pageSize) {
//        Integer count = tGlutDcKsbjMapper.selectCount(new TGlutDcKsbj());
//        if (count > limit) {
//            Double ceil = Math.ceil(count / limit);
//            for (int i = 0, length = ceil.intValue(); length > i; i++) {
        PageHelper.startPage(pageNo, pageSize, "ks_bh");
        List<TGlutDcKsbj> tGlutDcKsbjs = tGlutDcKsbjMapper.selectAll();
        mqService.directViewKsKsbj(tGlutDcKsbjs);
//            }
//        }
    }

    @Async("glutExecutor")
    @Override
    public void getViewKsKs(Integer pageNo, Integer pageSize) {
        PageHelper.startPage(pageNo, pageSize, "id");
        List<TGlutDcKs> tGlutDcKs = tGlutDcKsMapper.selectAll();
        log.info("考试列表", JSONObject.toJSONString(tGlutDcKs));
        mqService.directViewKsKs(tGlutDcKs);
    }

    @Async("glutExecutor")
    @Override
    public void getViewKsZyjsBj(Integer pageNo, Integer pageSize) {
        PageHelper.startPage(pageNo, pageSize, "zyjs_bh");
        List<TGlutDcZyjsBj> tGlutDcZyjsBjs = tGlutDcZyjsBjMapper.selectAll();
        mqService.directViewKsZyjsBj(tGlutDcZyjsBjs);
    }

    @Async("glutExecutor")
    @Override
    public void getViewKsZyjs(Integer pageNo, Integer pageSize) {
        PageHelper.startPage(pageNo, pageSize, "id");
        List<TGlutDcZyjs> tGlutDcZyjs = tGlutDcZyjsMapper.selectAll();
        mqService.directViewKsZyjs(tGlutDcZyjs);
    }

    @Async("glutExecutor")
    @Override
    public void getViewBmxx(Integer pageNo, Integer pageSize) {
        PageHelper.startPage(pageNo, pageSize, "dwh");
        List<TGlutDcBmxx> glutDcBmxxes = tGlutDcBmxxMapper.selectAll();
        mqService.directViewBmxx(glutDcBmxxes);
    }

    @Async("glutExecutor")
    @Override
    public void getViewJssysjzlb(Integer pageNo, Integer pageSize) {
        PageHelper.startPage(pageNo, pageSize, "jsh");
        List<TGlutDcJssysjzlb> tGlutDcJssysjzlbs = tGlutDcJssysjzlbMapper.selectAll();
        mqService.directViewJssysjzlb(tGlutDcJssysjzlbs);
    }

    @Async("glutExecutor")
    @Override
    public void getViewKsqlcJgxx(Integer pageNo, Integer pageSize) {
        PageHelper.startPage(pageNo, pageSize, "gh");
        List<Map> viewGlutJwKsqlcJgxxes = viewGlutJwKsqlcJgxxMapper.getJgxx();
        mqService.directViewJwKsqlcJgxx(viewGlutJwKsqlcJgxxes);

    }

    @Async("glutExecutor")
    @Override
    public void ksZyjsKaosheng(Integer pageNo, Integer pageSize) {
        PageHelper.startPage(pageNo, pageSize, "zyjs_bh");
        List<TGlutDcZyjsKaosheng> tGlutDcZyjsKaoshengs = tGlutDcZyjsKaoshengMapper.selectAll();
        mqService.directViewKsZyjsKaosheng(tGlutDcZyjsKaoshengs);
    }

    @Async("glutExecutor")
    @Override
    public void getViewKcbJs(Integer pageNo, Integer pageSize) {
        PageHelper.startPage(pageNo, pageSize, "jxbh");
        List<TGlutDcKcbJs> tGlutDcKcbJS = tGlutDcKcbJsMapper.selectAll();
        mqService.directViewKcbJs(tGlutDcKcbJS);
    }
}
